import java.util.Arrays;


class Student implements Comparable<Student>{
    String name;
    int age;
    int score;
    public Student(String name,int age,int score){
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        if(this.name.compareTo(o.name)<0){
            return 1;
        }else if(this.name.compareTo(o.name)>0 ){
            return -1;
        }else
            return 0;
    }
       /* if(this.score < o.score ){
            return 1;
        }else if(this.score  > o.score ){
            return -1;
        }else
            return 0;
    }*/

     /* if(this.age > o.age){
          return 1;
      }else if(this.age < o.age){
          return -1;
      }else
          return 0;
    }*/
}


public class Test {
    public static void main(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("小七",3,98);
        students[1] = new Student("小八",5,99);
        students[2] = new Student("小九",7,100);

      /*  Student[] students = new Student[]{
                 new Student("小七",3,98),
                 new Student("小八",5,99),
                 new Student("小九",7,100)};*/

        Arrays.sort(students);
        System.out.println(Arrays.toString(students));
    }
}
